const express = require('express');
const path = require("path");
const cors = require('cors');
const app = express();

app.use(express.static(__dirname));
app.use(express.json());
app.use(express.static(path.resolve(__dirname,'./demo')));
app.use(cors());

const data = [
    {
        id : Math.random().toString(36).slice(2),
        content : '好用推荐',
        addTime : "2024-03-10 01:01:01",
        upNum : 10,
        downNum :2
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '内容2',
        addTime : "2024-77-10 78:34:01",
        upNum : 0,
        downNum :0
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '我爱学习',
        addTime : "2024-03-77 55:55:01",
        upNum : 8,
        downNum :200
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '大连很好',
        addTime : "2024-25-10 88:88:01",
        upNum : 99,
        downNum :0
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '今天很冷',
        addTime : "2025-19-10 22:22:22",
        upNum : 0,
        downNum :20
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '大连很好',
        addTime : "2024-25-10 88:88:01",
        upNum : 99,
        downNum :0
    },
    {
        id : Math.random().toString(36).slice(2),
        content : '今天很冷',
        addTime : "2025-19-10 22:22:22",
        upNum : 0,
        downNum :20
    },
]
app.get('/getData',(req, res)=>{
    res.json({
        ok:1,
        data,
        msg: 'sxx'
    })

})
app.listen(80,()=>{
    console.log('成功')
})